﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UTable.Objects.Controls">
    <Style TargetType="{x:Type local:UButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="Control.Template">
                        <Setter.Value>
                            <ControlTemplate/>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Padding" Value="5,0,0,0"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="30"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:UButton}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="Press">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3"/>
                            </ThicknessAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="Release">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3"/>
                                <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1"/>
                            </ThicknessAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="Grid" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Rectangle x:Name="Base" Fill="{TemplateBinding Background}" Stroke="{x:Null}" StrokeThickness="1" RadiusX="5" RadiusY="5" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        <Rectangle x:Name="Button" StrokeThickness="1" RadiusX="5" RadiusY="5" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Rectangle.Stroke>
                                <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                    <GradientStop Color="#66000000" Offset="0"/>
                                    <GradientStop Color="#33000000" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                            <Rectangle.Fill>
                                <RadialGradientBrush GradientOrigin="0.496,-0.06">
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.954" ScaleY="1.192"/>
                                            <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                                            <RotateTransform Angle="180" CenterX="0.5" CenterY="0.5"/>
                                            <TranslateTransform X="-0.002" Y="-0.024"/>
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="#33FFFFFF" Offset="0"/>
                                    <GradientStop Color="#19FFFFFF" Offset="0.75"/>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="RenderOverlay" StrokeThickness="1" RadiusX="4" RadiusY="4" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Rectangle.Stroke>
                                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                    <GradientStop Color="#7FFFFFFF" Offset="0"/>
                                    <GradientStop Color="#0CFFFFFF" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                            <Rectangle.Fill>
                                <RadialGradientBrush GradientOrigin="0.5,0.072">
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="-3" ScaleY="-2"/>
                                            <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                                            <RotateTransform Angle="359.337" CenterX="0.5" CenterY="0.5"/>
                                            <TranslateTransform X="-0.001" Y="-0.126"/>
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="Transparent" Offset="0.205"/>
                                    <GradientStop Color="#26000000" Offset="0.652"/>
                                </RadialGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="CheckMark" Opacity="0" RadiusX="5" RadiusY="5" Margin="2">
                            <Rectangle.Fill>
                                <SolidColorBrush Color="White"/>
                            </Rectangle.Fill>
                            <!--Rectangle.BitmapEffect>
                                <OuterGlowBitmapEffect GlowColor="White" GlowSize="8"/>
                            </Rectangle.BitmapEffect-->
                        </Rectangle>
                        <Rectangle x:Name="Glow" Opacity="0" RadiusX="6" RadiusY="6" Margin="3" Fill="{TemplateBinding GlowBrush}">
                            <!--Rectangle.BitmapEffect>
                                <OuterGlowBitmapEffect GlowColor="White" GlowSize="8"/>
                            </Rectangle.BitmapEffect-->
                        </Rectangle>
                        <ContentPresenter x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}">
                            <ContentPresenter.RenderTransform>
                                <TranslateTransform X="0" Y="-1"/>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="3"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-1"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                            <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-1"/>
                                            <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="3"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="True"/>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="#A5333333"/>
                            <Setter Property="Fill" TargetName="Button" Value="#00000000"/>
                            <Setter Property="Stroke" TargetName="Button" Value="#33000000"/>
                            <Setter Property="Fill" TargetName="RenderOverlay" Value="#00000000"/>
                            <Setter Property="Opacity" TargetName="RenderOverlay" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>